package logic.gridSimInterface.user;
/*
 * Author Miroslav Bellak
 * Date: May 2007
 */

import java.util.Random;

import gridsim.Gridlet;

public class GridletComplex extends Gridlet{
	private double creationTime = 0;
	private double completionTerm = Double.MAX_VALUE; 
	private int predecessorId = -1;
	private String operatingSystem = "";
	private String architecture = "";

	public GridletComplex(int gridletID, double gridletLength, long gridletFileSize, long gridletOutputSize, 
			boolean record, double creationTime, String operatingSystem, String architecture) {
		super(gridletID, gridletLength, gridletFileSize, gridletOutputSize, record);
		this.creationTime = creationTime;
		this.operatingSystem = operatingSystem;
		this.architecture = architecture;
	}
	
	/**
	 * @return the creationTime
	 */
	public double getCreationTime() {
		return creationTime;
	}

	/**
	 * @return the architecture
	 */
	public String getArchitecture() {
		return architecture;
	}

	/**
	 * @return the operatingSystem
	 */
	public String getOperatingSystem() {
		return operatingSystem;
	}

	/**
	 * @return the predecessorId
	 */
	public int getPredecessorId() {
		return predecessorId;
	}

	/**
	 * @param predecessorId the predecessorId to set
	 */
	public void setPredecessorId(int predecessorId) {
		this.predecessorId = predecessorId;
	}

	/**
	 * @return the completionTerm
	 */
	public double getCompletionTerm() {
		return completionTerm;
	}

	/**
	 * @param completionTerm the completionTerm to set
	 */
	public void setCompletionTerm(double completionTerm) {
		this.completionTerm = completionTerm;
	}

	/**
	 * Generates completionTerm according to gridlet start time and gridlet length
	 *
	 */
	public void generateRandomCompletionTerm(long seed) {
		Random random = new Random(seed);
		this.completionTerm = this.creationTime + (this.getGridletLength() / 50) + random.nextInt(100); 
	}

}
